﻿using SosForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SosData;
namespace UOCmaker
{
    public partial class FormSelecUsuariosAviso : FormBase
    {

        sosContext db;

        #region " Constructores "
        
        /// <summary>
        /// Constructor
        /// </summary>
        public FormSelecUsuariosAviso()
        {
            InitializeComponent();
            db = new sosContext();
            usuarioBindingSource.DataSource = db.Users.ToList();
        }

        #endregion
       public List<string> usuarios;

        #region " Metodos "

        /// <summary>
        /// Aceptar seleccion
        /// </summary>
        private void Aceptar()
        {
            usuarios = new List<string>();
            DataGridViewSelectedRowCollection rows = this.usuarioDataGridView.SelectedRows;
            foreach (DataGridViewRow item in rows)
            {
                usuarios.Add(item.Cells[0].Value.ToString());
            }
            this.Close();
        }

        /// <summary>
        /// Cancelar seleccion
        /// </summary>
        private void Cancelar()
        {
            usuarios = null;
            this.Close();
        }
        #endregion

        private void butAceptar_Click(object sender, EventArgs e)
        {
            this.Aceptar();
        }

        private void butCancelar_Click(object sender, EventArgs e)
        {
            this.Cancelar();
        }
    }
}
